<?php

if (!defined('TOBBIVM'))
	header('location:/template/notrepassing.php');
/**
 * This file is part of TobbiVMShop.
 *
 * TobbiVMShop is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TobbiVMShop is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with TobbiVMShop.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * create table to browse payment-plugins incl. config-data
 * get: payment.tpl.php
 * used from payment.page.php
 *
 * @version    $Id$
 * @package    TobbiVM-Shop
 * @copyright  Copyright (C) 2012
 * @author     Norbert Gebert
 * @license    GPL3
 */
db::getInstance()->orderBy('plugin_name', 'ASC');
$result = db::getInstance()->get('plugin');

$refPage->assign('page_title', _('Plugins'));
$refPage->assign('summary', _('This table gives a overview to installed X-Plugins'));

$refPage->assign('pluginName', _('X-Plugin'));

$refPage->assign('Form_Start',
	'<form class="niceform fieldset paymentTable" action="' .
	'index2.php?page=' . $page . '&sub=' . $subpage .
	'" method="post"><fieldset>');
$refPage->assign('Form_End', '</fieldset></form>');

if (db::getInstance()->count <= 0)
{
	$data[] = array('plugin_set' => '-',
	 'plugin_namex' => _('No plugin installed'));
}
else
{
	foreach ($result as $buffer)
	{
		$plugin_namey = '<a href="index2.php?page=' . $page . '&sub=' . $subpage .
			'&id=' . $buffer['plugin_id'] . '&func=edit">' . $buffer['plugin_name'] . '</a>';

		$data[] = array('plugin_set' => '<input type="checkbox" name="marker[]" value="' .
		 $buffer['plugin_id'] . '" />',
		 'plugin_namex' => $plugin_namey);
	}
}

$refPage->assign('data', $data);

$refPage->assign('btn_Delete',
	'<input type="submit" name="submit" id="delete" value="' .
	_('Delete entry') . '" />');
$refPage->assign('btn_New',
	'<input type="submit" name="submit" id="new" value="' .
	_('Search new plugins') . '" />');

$refPage->addtpl('content', '/' . $page . '/' . $subpage . '.tpl.php');
?>